package org.minos.edit.controller
{
	import flash.display.DisplayObject;
	import org.minos.edit.Main;
	import org.minos.edit.view.EditMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author Minos
	 */
	public class FitStageCommand extends SimpleCommand
	{
		
		override public function execute( notification : INotification ) : void
		{
			super.execute( notification );
			
			var obj : DisplayObject = notification.getBody() as DisplayObject;
			if ( !obj )
				return;
			//center
			var app : Main = facade.retrieveMediator( EditMediator.NAME ).getViewComponent() as Main;
			obj.x = Math.floor(( app.mainWindow.getWidth() - obj.width ) / 2 );
			obj.y = Math.floor(( app.mainWindow.getHeight() - obj.height ) / 2 );
			//
			
		}
	
	}

}